<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<div class="table-responsive">
    <table class="table table-bordered">
        <thead>
        <tr class="jqgfirstrow" role="row">
            <th th:if="${other}==0" class="text-center"><div class="table-first-id">ID</div></th>
            <th th:if="${other}==0" class="text-center" width="18%">优惠券名称</th>
            <th th:if="${other}==0" class="text-center" width="5%">类型</th>
            <th th:if="${other}==0" class="text-center" width="10%">金额/折扣</th>
            <th th:if="${other}==0" class="text-center" width="5%">数量</th>
            <th th:if="${other}==0" class="text-center" width="5%">使用范围</th>
            <th th:if="${other}==0" class="text-center" width="22%">有效期</th>
            <th th:if="${other}==0" class="text-center" width="9%">获取条件</th>
            <th th:if="${other}==0" class="text-center" width="5%">状态</th>
            <th th:if="${other}==0" class="text-center" width="15%">操作</th>
            <th th:if="${other}==1" class="text-center"><div class="table-first-id">ID</div></th>
            <th th:if="${other}==1" class="text-center" width="15%">优惠券批次</th>
            <th th:if="${other}==1" class="text-center" width="10%">类型</th>
            <th th:if="${other}==1" class="text-center" width="10%">金额/折扣</th>
            <th th:if="${other}==1" class="text-center" width="30%">使用范围</th>
            <th th:if="${other}==1" class="text-center" width="30%">有效期</th>
        </tr>
        </thead>
    </table>
    <div class="J_V_tabContent table-xScrollWrap">
        <table class="table table-bordered table-hover table-xs-content">
            <tbody id="tbodyCoupon">
            <tr class="jqgfirstrow" role="row">
                <th th:if="${other}==0" class="text-center"><div class="table-first-id">&nbsp;</div></th>
                <th th:if="${other}==0" class="text-center" width="18%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="5%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="10%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="5%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="5%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="22%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="9%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="5%">&nbsp;</th>
                <th th:if="${other}==0" class="text-center" width="15%">&nbsp;</th>
                <th th:if="${other}==1" class="text-center"><div class="table-first-id">&nbsp;</div></th>
                <th th:if="${other}==1" class="text-center" width="15%">&nbsp;</th>
                <th th:if="${other}==1" class="text-center" width="10%">&nbsp;</th>
                <th th:if="${other}==1" class="text-center" width="10%">&nbsp;</th>
                <th th:if="${other}==1" class="text-center" width="30%">&nbsp;</th>
                <th th:if="${other}==1" class="text-center" width="30%">&nbsp;</th>
            </tr>
                <tr th:if="${#lists.isEmpty(dataMap['list'])}">
                    <td colspan="10" class="text-center">
                        <div class="noDataTipsBox">
                            <p><span class="c-4e fs16">亲，还没有数据~~~</span></p>
                        </div>
                    </td>
                </tr>
                <tr th:if="!${#lists.isEmpty(dataMap['list'])}" th:each="coupon : ${dataMap['list']}" th:id="'tr_'+${coupon['id']}">
                    <td class="text-center">
                        <input th:if="${coupon['status']}!=4" type="checkbox" class="i-checks " th:attr="data-minamount=${coupon['minAmount']}"  name="couponId" th:value="${coupon['id']}" th:text="${coupon['id']}">
                        <span th:if="${coupon['status']}==4" th:text="${coupon['id']}"></span>
                    </td>
                    <td class="text-center" th:attr="id='coupon-name-'+${coupon['id']}"  th:text="${coupon['title']}"></td>
                    <td class="text-center">
                        <span th:if="${coupon['type']}==1">折扣券</span>
                        <span th:if="${coupon['type']}==2">定额券</span>
                    </td>
                    <td class="text-center" th:attr="id='coupon-price-'+${coupon['id']}" th:text="${coupon['limitAtion']}"></td>
                    <td th:if="${other}==0" class="text-center" th:text="${coupon['codeNum']}"></td>
                    <td class="text-center"><span class="coupon-shop-data" th:attrprepend="data-id=${coupon['id']}"><a href="javascript:void(0)">查看范围</a></span></td>
                    <td class="text-center">
                       <span class="pie"  th:text="${coupon['timeType']}==1 ? ${coupon['beginTime']}+'—'+${coupon['endTime']}:'永久'">
                        </span>
                    </td>
                    <td th:if="${other}==0" class="text-center">
                        <th:block th:if="${coupon['receiveType']}==1">商品详情领取</th:block>
                        <th:block th:if="${coupon['receiveType']}==2 and ${coupon['orientType']}==1">
                            <th:block th:if="${coupon['userType']}==1">全部用户</th:block>
                            <th:block th:if="${coupon['userType']}==2">部分用户</th:block>
                        </th:block>
                        <th:block th:if="${coupon['receiveType']}==2 and ${coupon['orientType']}==2">
                            <span th:if="${coupon['conditions']}==1">手动发放</span>
                            <span th:if="${coupon['conditions']}==2">新用户注册后自动获取</span>
                            <span th:if="${coupon['conditions']}==3">学员生日获取</span>
                            <span th:if="${coupon['conditions']}==4">邀请注册获取</span>
                            <span th:if="${coupon['conditions']}==5">消费任意金额获取</span>
                            <span th:if="${coupon['conditions']}==6">免费直播发放</span>
                            <span th:if="${coupon['conditions']}==7">活动</span>
                            <span th:if="${coupon['conditions']}==11">积分兑换</span>
                        </th:block>
                    </td>
                    <td th:if="${other}==0" class="text-center status" th:attrprepend="id='coupon-status-'+${coupon['id']}">
                        <span th:if="${coupon['status']} == 0" class="label label-info">未开始</span>
                        <span th:if="${coupon['status']} == 1" class="label label-info">进行中</span>
                        <span th:if="${coupon['status']} == 2"  class="label label-danger">已停止</span>
                        <span th:if="${coupon['status']} == 7" class="label label-danger">已结束</span>
                    </td>
                    <td th:if="${other}==0" class="text-center">
                        <a th:href="@{/admin/op/coupon/toOpCouponInfo?id={couponId}(couponId=${coupon['id']})}" class="c-master fs14" data-toggle="tooltip" data-placement="bottom" data-original-title="查看"><i class="fa fa-eye"></i></a>
                        <a th:if="${coupon['status']}==1" href="javascript:void(0);" class="c-master fs14 ml5 unlockAndHistory" data-status="2" th:attr="data-id=${coupon['id']},id='unlockAndHistory_'+${coupon['id']}"  data-toggle="tooltip" data-placement="bottom" data-original-title="停止"><i class="fa fa-pause"></i></a>
                        <a th:if="${coupon['status']}==2" href="javascript:void(0);" class="c-master fs14 ml5 unlockAndHistory" data-status="1" th:attr="data-id=${coupon['id']},id='unlockAndHistory_'+${coupon['id']}"   data-toggle="tooltip" data-placement="bottom" data-original-title="恢复"><i class="fa fa-history"></i></a>
                        <a  th:if="${coupon['status']}==1 and ${coupon['conditions']}!=11"  href="javascript:void (0);" class="c-master fs14 ml5 selectUser"  th:attr="data-id=${coupon['id']},id='selectUser_'+${coupon['id']}"  data-toggle="tooltip" data-placement="bottom" data-original-title="赠送"><i class="fa fa-gift"></i></a>
                        <a th:if="${coupon['status']} > 1" href="javascript:void (0);" class="c-master fs14 ml5 deleteCoupon"   th:attr="data-id=${coupon['id']}"  data-toggle="tooltip" data-placement="bottom" data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <!-- 分页，开始 -->
    <div data-th-replace="layout/adminPage"></div>
    <!-- 分页，结束 -->
</div>
